using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.Unity;
using System.Runtime.CompilerServices;

namespace UnityContrib.CanonicalObjectExtension
{
    public class PartialObjectPolicy : IPartialObjectPolicy
    {
        private Type fromType, toType;
        private string canonicalName;
        private string typeName;
        private int fromTypeUniqueObjectID;
        private int toTypeUniqueObjectID;
        private Guid partialObjectID;

        public PartialObjectPolicy(Type fromType, Type toType, string canonicalName, string typeName)
        {
            this.fromType = fromType;
            this.toType = toType;
            this.canonicalName = canonicalName;
            this.typeName = typeName;
            this.fromTypeUniqueObjectID = RuntimeHelpers.GetHashCode(fromType);
            this.toTypeUniqueObjectID = RuntimeHelpers.GetHashCode(toType);
            this.partialObjectID = Guid.NewGuid();
        }

        public Type FromType { get { return fromType; } }
        public Type ToType { get { return toType; } }
        public string CanonicalName { get { return canonicalName; } }
        public int FromTypeUID { get { return fromTypeUniqueObjectID; } }
        public int ToTypeUID { get { return toTypeUniqueObjectID; } }
        public Guid PartialObjectID { get { return partialObjectID; } }
    }
}
